﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace MessengerBot
{
    /// <summary>
    /// This attribute can be applied to classes that implement <see cref="ICommand"/>
    /// to specify the name of the command they implement.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
    public sealed class CommandAttribute : Attribute
    {
        /// <summary>
        /// This is the backing field for the <see cref="Name"/> property.
        /// </summary>
        private string _Name;

        /// <summary>
        /// Initializes a new instance of the <see cref="CommandAttribute"/> class.
        /// </summary>
        /// <param name="name">
        /// The name of the command the target class implements.
        /// </param>
        public CommandAttribute(string name)
        {
            _Name = (name ?? string.Empty).Trim();
        }

        /// <summary>
        /// Gets or sets the name of the command the target class implements.
        /// </summary>
        public string Name
        {
            get
            {
                return _Name;
            }

            set
            {
                _Name = (value ?? string.Empty).Trim();
            }
        }
    }
}